package com.dragon.mmochat.message;

import com.dragon.mmochat.MmochatConstant;
import com.dragon.mmochat.model.role.MmochatPlayer;
import com.skymobi.buffer.SkymobiBuffer;
import com.skymobi.message.SkymobiModuleMessage;

public class MmochatBackToOldServer extends SkymobiModuleMessage {
	int roleId;

	public MmochatBackToOldServer() {
		setMsgCode(MmochatConstant.MSGCODE_MMOCHAT_BACKTO_OLDSERVER);
	}

	public MmochatBackToOldServer(int dstId) {
		setDstId(dstId);
		setMsgCode(MmochatConstant.MSGCODE_MMOCHAT_BACKTO_OLDSERVER);
	}

	@Override
	protected void decodeBody(SkymobiBuffer in) {
		roleId = MmochatPlayer.getRealRoleId(in.getInt());
	}

	@Override
	protected void encodeBody(SkymobiBuffer out) {
		out.putInt(roleId);
	}

	public int getRoleId() {
		return roleId;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

}
